furny.ga.util
Class Distance

java.lang.Object
  extended by furny.ga.util.Distance

public final class Distance
extends java.lang.Object

Utility class for calculating furniture layout individual distance. The distance is always normalized (in [0;1]).

Since:
11.08.2012
Author:
Stephan Dreyer

Constructor Summary
private Distance()
          Instantiation is not allowed.
 
Method Summary
static float calcDistance(FurnLayoutIndividual ind1, FurnLayoutIndividual ind2, GAContext context)
          Deprecated. This old distance calculation was not working well.
static float calcDistance2(FurnLayoutIndividual ind1, FurnLayoutIndividual ind2, GAContext context)
          Distance calculation for two furniture layouts.
private static float furnEntryDistance(FurnEntry e1, FurnEntry e2, GAContext context)
          Calculates the distance of two genes (FurnEntrys) in the interval of [0;1].
private static float leftFurnEntryDistance(FurnEntryList l1, FurnEntryList l2, GAContext context)
          Left distance calculation of two furniture entry lists.
private static float lowestFurnEntryDistance(FurnEntry entry, FurnEntryList others, GAContext context)
          Calculates the lowest distance between a furniture entry and a list of other furniture entries.
static void main(java.lang.String[] args)
          Main method for testing.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Distance

private Distance()
Instantiation is not allowed.

Since:
11.08.2012
Method Detail

calcDistance

@Deprecated
public static float calcDistance(FurnLayoutIndividual ind1,
                                            FurnLayoutIndividual ind2,
                                            GAContext context)
Deprecated. This old distance calculation was not working well.

Calculates the distance of two chromosomes in the interval of [0;1].

Parameters:
ind1 - The first individual
ind2 - The second individual
context - The GA context
Returns:
The normalized distance of the two individuals
Since:
18.02.2012

calcDistance2

public static float calcDistance2(FurnLayoutIndividual ind1,
                                  FurnLayoutIndividual ind2,
                                  GAContext context)
Distance calculation for two furniture layouts.

Parameters:
ind1 - The first individual.
ind2 - The second individual.
context - The GA context.
Returns:
Distance in [0;1].
Since:
11.08.2012

leftFurnEntryDistance

private static float leftFurnEntryDistance(FurnEntryList l1,
                                           FurnEntryList l2,
                                           GAContext context)
Left distance calculation of two furniture entry lists.

Parameters:
l1 - The left list.
l2 - The right list.
context - The GA context.
Returns:
The distance in [0;1].
Since:
11.08.2012

lowestFurnEntryDistance

private static float lowestFurnEntryDistance(FurnEntry entry,
                                             FurnEntryList others,
                                             GAContext context)
Calculates the lowest distance between a furniture entry and a list of other furniture entries.

Parameters:
entry - The furniture entry.
others - The other entries.
context - The GA context.
Returns:
The distance in [0;1].
Since:
11.08.2012

furnEntryDistance

private static float furnEntryDistance(FurnEntry e1,
                                       FurnEntry e2,
                                       GAContext context)
Calculates the distance of two genes (FurnEntrys) in the interval of [0;1].

Parameters:
e1 - The first FurnEntry
e2 - The second FurnEntry
context - The ga context
Returns:
The normalized distance between the two genes.
Since:
14.02.2012

main

public static void main(java.lang.String[] args)
Main method for testing.

Parameters:
args - No arguments
Since:
11.08.2012